<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"> 
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <p:panel id="panel" header="Questionários">
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="5000"/>

                    <table style="min-height:500px; width: 100%">
                        <tr>
                            <td style="width: 20%; vertical-align:top;">
                                <p:menu style="width:200px;" >  
                                    <p:submenu label="Questionário">  
                                        <p:menuitem value="Cadastrar" 
                                                    actionListener="#{managerRedirect.redirect('createQuestionnaire.xhtml')}"
                                                    update="@form" icon="ui-icon-circle-plus"/>  
                                        <p:menuitem value="Pesquisar"
                                                    actionListener="#{managerRedirect.redirect('searchQuestionnaire.xhtml')}"
                                                    icon="ui-icon-circle-zoomout"/>   
                                    </p:submenu>
                                </p:menu>

                            </td>
                            <td style="vertical-align:top;">

                                <p:dataTable id="dataQuest" value="#{managerSearchQuestionnaire.lstQuestionnaires()}"
                                             var="q" emptyMessage="Nenhum Questionário"
                                             styleClass="dataTable" style="width: 100%;">                       
                                    <f:facet name="header">
                                        <h:outputText value="Questionários"/>
                                    </f:facet>

                                    <p:column headerText="Titulo" style="font-size: 12px; width: 35%;">
                                        <h:outputText value="#{q.titulo}" style="font-size: 12px;"/>
                                    </p:column>

                                    <p:column headerText="Situação" style="font-size: 12px; width: 25%;">
                                        <h:outputText value="Em Construção" style="font-size: 12px; padding: 120px;"/>      
                                    </p:column>

                                    <p:column headerText="Opções" style="font-size: 12px; width: 7%;">
                                        <p:commandButton icon="ui-icon-help" actionListener="#{managerEditCategory.addIssues(q)}" 
                                                         title="Adicionar Perguntas" immediate="true" process="@this" update="@form"/>
                                        <p:commandButton icon="ui-icon-document" 
                                                         actionListener="#{managerEditQuestionnaire.redirectEditQuestionnaire('editQuestionnaire.xhtml', q)}"
                                                         title="Editar Questionnaire" immediate="true" process="@this" update="@form"/>

                                        <p:blockUI block=":panel" trigger="graph">  
                                    CARREGANDO...<br />  
                                    <p:graphicImage value="/media/css/imagens/ajax-loader.gif"/>  
                                </p:blockUI>
                                        <p:commandButton icon="ui-icon-circle-zoomin" actionListener="#{managerEditCategory.viewIssues(q)}" 
                                                         title="Visualizar Questionário" immediate="true" process="@this" update="@form"/>

                                        <p:commandButton icon="ui-icon-image" 
                                                         id="graph"
                                                         actionListener="#{managerRedirect.redirect('analyzeQuestionnaire.xhtml?action=1')}" 
                                                         title="Analisar Questionário #{q.id}" immediate="true" process="@this" update="@form" />

                                        <p:commandButton icon="ui-icon-trash" title="Excluir Questionário"
                                                         actionListener="#{managerCreateQuestionnaire.delete(q)}" immediate="true" process="@this" update="@form"  />
                                    </p:column>
                                </p:dataTable>
                                
                            </td>
                        </tr>
                    </table>
                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>
</html>